package app

import (
	validate_enum "oc_saas/enum/validate"
	"oc_saas/glo"
	oc_validate "oc_saas/utils/validate"

	"github.com/go-playground/validator/v10"
)

type ocValidator struct{}

// 初始化自定义验证
func (*ocValidator) InitValidator() {
	validate := validator.New()
	validate.RegisterValidation("password", oc_validate.GloValidStr(validate_enum.PASSWORD)) //密码校验
	validate.RegisterValidation("username", oc_validate.GloValidStr(validate_enum.USERNAME)) //用户名校验
	validate.RegisterValidation("ocPerms", oc_validate.GloValidStr(validate_enum.PERMS))     //权限标识校验
	validate.RegisterValidation("ocName", oc_validate.GloValidStr(validate_enum.Name))       //权限路由名称
	validate.RegisterValidation("ocPath", oc_validate.GloValidStr(validate_enum.Path))       //权限路径
	validate.RegisterValidation("ocHttps", oc_validate.GloValidStr(validate_enum.Https))     //https协议
	validate.RegisterValidation("ocReqType", oc_validate.GloValidStr(validate_enum.Https))   //请求类型
	glo.OC_VALID = validate
}

var ocValidatorApp = new(ocValidator)
